<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        *{
            margin: 0px;padding: 0px;
        }
    </style>
</head>
<body>
    <div id="box"></div>
    <script type="text/javascript">
        var box =document.getElementById("box");
        var count=5;
        var speed = 1000;
        setTimeout(goPage,speed);//是指，多少秒之后执行这个函数
        function goPage() {
            // 注意这里引号的使用
            box.innerHTML = "<a href='http://www.baidu.com'>本页面将在"+count+"秒之后跳转页面</a>"
            count--;
            if(count<=0){
                window.location.href = "http://www.baidu.com";
            }else{
                setTimeout(goPage,speed);
            }
        }
    </script>

</body>
</html>